export function setOption(chart, piedata) {
  var option = {
    xAxis: {
      type: 'category',
      boundaryGap: true,
      data: piedata.inAndOutData.map(s=> s.day),
      show: true
    },
    tooltip: {
      trigger: 'axis'
    },
    legend: {
      data: ['收入', '支出'],
      bottom: 0,
      left: 'center',
      z: 100
    },
    grid: {
      left: '15%',
      right: '8%',
      top: 20,
      bottom: 50
    },
    yAxis: {
       type: 'value'
    },
    series: [{
      name: '收入',
      type: 'line',
      smooth: true,
      data: piedata.inAndOutData.map(s=> s.incomePrice),
    }, {
      name: '支出',
      type: 'line',
      smooth: true,
      data: piedata.inAndOutData.map(s=> s.expendPrice),
    }]
  };

  chart.setOption(option);
  return chart;
}
export function setOptionb(chart, piedata) {
  var option = {
    xAxis: {
      type: 'category',
      data: piedata.orderNumData.map(s=> s.day),
    },
    tooltip: {
      trigger: 'axis'
    },
    grid: {
      left: '10%',
      right: '8%',
      top: 20,
      bottom: 20
    },
    yAxis: {
      type: 'value'
    },
    series: [
      {
        data: piedata.orderNumData.map(s=> s.orderCount),
        type: 'bar'
      }
    ]
  };

  chart.setOption(option);
  return chart;
}
export function setOptionc(chart, piedata) {
  var option = {
    grid: {
      left: '3%',
      right: '4%',
      top: '3%',
      bottom: '3%',
      containLabel: true
    },
    xAxis: {
      type: 'value',
      boundaryGap: [0, 0.01]
    },
    tooltip: {
      trigger: 'axis'
    },
    yAxis: {
      type: 'category',
      data: piedata.incomeSourceData.map(s=> s.orderType),
    },
    series: [
      {
        type: 'bar',
        data: piedata.incomeSourceData.map(s=> s.countPrice),
      }
    ]
  };

  chart.setOption(option);
  return chart;
}